﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace TB_WS.ASMX
{
    /// <summary>
    /// Price_Push 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class Price_Push : System.Web.Services.WebService
    {

        [WebMethod(Description ="文档内容上传")]
        public string PUSH_Control(string TXT_Str)
        {
            string[] Link_Info = TXT_Str.Split('\n');
            string Goods_ID = Link_Info[2].ToString();
            string Goods_Name = Link_Info[0].ToString();
            string Seller_Nick = Link_Info[1].ToString();
            string Goods_SKU_Map = Link_Info[3].ToString();
            string Goods_Price_Map = Link_Info[4].ToString();
            Class.Price_Push.Match_Price_Str(Goods_ID, Goods_Price_Map,Goods_SKU_Map);
            
            return "Success";
        }

        

        [WebMethod(Description ="批量推送")]
        public string Push_Type(string Type_Name,string Push_Str)
        {
            return Class.Price_Push.Push_Type(Type_Name, Push_Str);
        }

        [WebMethod(Description ="获取关注列表")]
        public DataSet Get_PP_Follow_List(string Seller_Nick)
        {
            return Class.Price_Push.Get_Follow_Link(Seller_Nick);
        }

        [WebMethod(Description ="获取所有列表")]
        public DataSet Get_Link()
        {
            return Class.Price_Push.get_PP_Link();
        }

        [WebMethod(Description ="新增链接")]
        public int INSERT_LINK(string URL,string Goods_ID,
            string Goods_Name,string Seller_Nick,string Link_Type)
        {
            return Class.Price_Push.insert_PP_Link(URL, Goods_ID, Goods_Name,
                Seller_Nick, Link_Type);
        }

        [WebMethod(Description ="新增关注")]
        public int ADD_PP_FOLLOW(int Link_ID,int Seller_ID)
        {
            return Class.Price_Push.Insert_PP_Follow(Link_ID, Seller_ID);
        }

        [WebMethod(Description ="取消关注")]
        public int UN_FOLLOW_PP_LINK(int Link_ID,int Seller_ID)
        {
            return Class.Price_Push.UN_Follow_Link(Link_ID, Seller_ID);
        }

        [WebMethod(Description ="获取链接类型")]
        public DataSet Get_Link_Type()
        {
            return Class.Price_Push.Get_PP_Link_Type();
        }
    }
}
